package com.firebird.app.fekpsl.ui.activity.sword.community

import android.os.Bundle
import android.app.Activity
import android.content.Intent
import com.firebird.app.fekpsl.R
import com.firebird.app.fekpsl.adapter.sword.community.ShowTypeAdapter
import com.firebird.app.fekpsl.bean.OptionType
import kotlinx.android.synthetic.main.sword_community.*

class SwordCommunityActivity : Activity() {

    var showTypeAdapter:ShowTypeAdapter?=null
    var data=ArrayList<OptionType>()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.sword_community)
        initData()
        initEvent()
    }

    fun initData() {
        data.clear()
        data.add(OptionType(R.mipmap.ioc_competition_answer,"答题大厅","进入大厅选择需要进入的房间或随机匹配对手","android.activity.ROOMLISTACTIVITY"))
        showTypeAdapter=ShowTypeAdapter(this@SwordCommunityActivity,R.layout.sword_community_layout_show_type_item,data)
        lv_show_type.adapter=showTypeAdapter
    }

    fun initEvent() {
        lv_show_type.setOnItemClickListener { adapterView, view, i, l ->
            var intent= Intent(showTypeAdapter!!.getItem(i).action)
            startActivity(intent)
        }
    }
}
